﻿using CustomCommons;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Production.Api.Read.Application.Command.StudentCommand;
using ProductionDomain;

namespace Production.Api.Read.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class StudentController : ControllerBase
    {
        private readonly IMediator _mediator;
        public StudentController(IMediator mediator)
        {
            _mediator = mediator;
        }


        [HttpGet]
        public async Task<ApiResult<List<Student>>> GetStudentAll()
        {
            var command = new StudentQueryCommand();

            return await _mediator.Send(command);
        }
    }
}
